/** 公共样式表 **/

import { Platform, StyleSheet, StatusBar } from 'react-native';
import { isAndroid, isIOS, NAV_BAR_HEIGHT_ANDROID, NAV_BAR_HEIGHT_IOS, windowWidth } from './platform';
import { getStatusBarHeight } from "react-native-status-bar-height";

export const commonStyles = StyleSheet.create(
    {
        /**容器**/
        container: {
            flex: 1,
            backgroundColor: '#F0F2F5'
        },
        body: {
            flex: 1,
            backgroundColor: 'white'
        },
        body_primary: {
            flex: 1,
            backgroundColor: '#F9D63B'
        },

        /**
         * 填充并居中
         */
        layout_content: {
            flex: 1,
            alignItems: 'center',
            justifyContent: 'center',
        },

        scrollStyle: {
            flex: 1,
        },
        /**
         * 居中
         */
        center: {
            alignItems: 'center',
            justifyContent: 'center',
        },
        /**
         * 水平方向全屏分割线,高度1,
         */
        split_line: { backgroundColor: '#e4e4e4', height: 1, width: windowWidth },

        /***文本大小和颜色*/
        text_white: { fontSize: 14, color: '#ffffff' },
        text_white_50: { fontSize: 14, color: '#ffffff7f' },
        text_white_10: { fontSize: 10, color: '#ffffff' },
        text_white_10_80: { fontSize: 10, color: '#ffffff80' },
        text_white_11: { fontSize: 11, color: '#ffffff' },
        text_white_12: { fontSize: 12, color: '#ffffff' },
        text_white_13: { fontSize: 13, color: '#ffffff' },
        text_white_12_7: { fontSize: 12, color: '#ffffffb3' },
        text_white_14_7: { fontSize: 14, color: '#ffffffb3' },
        text_white_15: { fontSize: 15, color: '#ffffff' },
        text_white_15_bold: { fontSize: 15, color: '#ffffff', fontWeight: 'bold' },
        text_white_14: { fontSize: 14, color: '#ffffff' },
        text_white_17: { fontSize: 17, color: '#ffffff' },
        text_white_16: { fontSize: 16, color: '#ffffff' },
        text_white_19: { fontSize: 19, color: '#ffffff' },
        text_white_26: { fontSize: 26, color: '#ffffff' },
        text_white_20: { fontSize: 20, color: '#ffffff' },
        text_white_32: { fontSize: 32, color: '#ffffff' },
        text_white_30: { fontSize: 30, color: '#ffffff' },
        text_white_18: { fontSize: 18, color: '#ffffff' },
        text_white_eee: { fontSize: 13, color: '#eeeeee' },

        text_trans_14: { fontSize: 14, color: '#00000000' },

        text_black: { fontSize: 14, color: '#0A0A0A' },
        text_black_13: { fontSize: 13, color: '#0A0A0A' },
        text_black_13_bold: { fontSize: 13, color: '#0A0A0A', fontWeight: 'bold' },
        text_black_14_bold: { fontSize: 14, color: '#0A0A0A', fontWeight: 'bold' },
        text_black_15_bold: { fontSize: 15, color: '#0A0A0A', fontWeight: 'bold' },
        text_black_14: { fontSize: 14, color: '#0A0A0A' },
        text_black_14_25: { fontSize: 14, color: '#0A0A0A', lineHeight: 25 },
        text_black_11: { fontSize: 11, color: '#0A0A0A' },
        text_black_10: { fontSize: 10, color: '#0A0A0A' },
        text_black_12: { fontSize: 12, color: '#0A0A0A' },
        text_black_15: { fontSize: 15, color: '#0A0A0A' },
        text_black_16: { fontSize: 16, color: '#0A0A0A' },
        text_black_16_bold: { fontSize: 16, color: '#0A0A0A', fontWeight: 'bold' },
        text_black_17_bold: { fontSize: 17, color: '#0A0A0A', fontWeight: 'bold' },
        text_black_17: { fontSize: 17, color: '#0A0A0A' },
        text_black_18: { fontSize: 18, color: '#0A0A0A' },
        text_black_18_bold: { fontSize: 18, color: '#0A0A0A' , fontWeight: 'bold'},
        text_black_20: { fontSize: 20, color: '#0A0A0A' },
        text_black_20_bold: { fontSize: 20, color: '#0A0A0A', fontWeight: 'bold' },
        text_black_24: { fontSize: 24, color: '#0A0A0A' },
        text_black_19: { fontSize: 19, color: '#0A0A0A' },
        text_black_19_bold: { fontSize: 19, color: '#0A0A0A', fontWeight: 'bold' },
        text_black_28: { fontSize: 28, color: '#0A0A0A' },
        text_black_36: { fontSize: 36, color: '#0A0A0A' },
        text_black_40: { fontSize: 40, color: '#0A0A0A' },
        text_black000_18: { fontSize: 18, color: '#000000' },
        text_black000_14: { fontSize: 14, color: '#000000' },
        text_black222_14: { fontSize: 14, color: '#222222' },
        text_black222_18: { fontSize: 18, color: '#222222' },
        text_black485_14: { fontSize: 14, color: '#485865' },
        text_black666_32: { fontSize: 32, color: '#0A0A0A' },
        text_black666_17: { fontSize: 17, color: '#0A0A0A' },
        text_black666_12: { fontSize: 12, color: '#0A0A0A' },
        text_black666_10: { fontSize: 10, color: '#0A0A0A' },
        text_black666_18: { fontSize: 18, color: '#0A0A0A' },
        text_black666_13: { fontSize: 13, color: '#0A0A0A' },
        text_black666_14: { fontSize: 14, color: '#0A0A0A' },
        text_black666_14_25: { fontSize: 14, color: '#0A0A0A', lineHeight: 25 },

        text_trans_30: { fontSize: 30, color: 'transparent' },

        text_pink: { fontSize: 12, color: '#FFCBE1' },

        text_red: { fontSize: 14, color: '#FF1E34' },
        text_red_13: { fontSize: 13, color: '#FF1E34' },
        text_red_14: { fontSize: 14, color: '#FF1E34' },
        text_red_12: { fontSize: 12, color: '#FF1E34' },
        text_red_10: { fontSize: 10, color: '#FF1E34' },
        text_red_15: { fontSize: 15, color: '#FF1E34' },
        text_red_16: { fontSize: 16, color: '#FF1E34' },
        text_red_17: { fontSize: 17, color: '#FF1E34' },
        text_red_20: { fontSize: 20, color: '#FF1E34' },
        text_red_24: { fontSize: 24, color: '#FF1E34' },
        text_red_30: { fontSize: 30, color: '#FF1E34' },
        text_redC8_13: { fontSize: 13, color: '#C8213F' },
        text_redff_18: { fontSize: 18, color: '#FF1E34' },
        text_redff_32: { fontSize: 32, color: '#FF1E34' },
        text_redff_14: { fontSize: 14, color: '#FF1E34' },
        text_redff_12: { fontSize: 12, color: '#FF1E34' },
        text_redfe_12: { fontSize: 12, color: '#FE2443' },
        text_redfe_14: { fontSize: 14, color: '#FE2443' },

        text_gray: { fontSize: 14, color: '#8E8E8E' },
        text_gray_15: { fontSize: 14, color: '#8E8E8E' },
        text_gray_16: { fontSize: 16, color: '#8E8E8E' },
        text_gray_16_25: { fontSize: 16, color: '#8E8E8E', lineHeight: 25 },
        text_gray_17: { fontSize: 17, color: '#8E8E8E' },
        text_gray_13: { fontSize: 13, color: '#8E8E8E' },
        text_gray_12: { fontSize: 12, color: '#8E8E8E' },
        text_gray_12_25: { fontSize: 12, color: '#8E8E8E', lineHeight: 25 },
        text_gray_10: { fontSize: 10, color: '#8E8E8E' },
        text_gray_10_20: { fontSize: 10, color: '#8E8E8E', lineHeight: 20 },
        text_gray_14_25: { fontSize: 14, color: '#8E8E8E', lineHeight: 25 },
        text_gray_14: { fontSize: 14, color: '#8E8E8E' },
        text_gray_11: { fontSize: 11, color: '#8E8E8E' },
        text_gray_30: { fontSize: 30, color: '#8E8E8E' },
        text_gray72_13: { fontSize: 13, color: '#727272' },
        text_grayBB_12: { fontSize: 12, color: '#BBBBBB' },
        text_graycc_20: { fontSize: 20, color: '#cccccc' },
        text_graycc_12: { fontSize: 12, color: '#cccccc' },

        text_gray88_12: { fontSize: 12, color: '#888888' },
        text_gray88_15: { fontSize: 15, color: '#888888' },

        text_purple_12: { fontSize: 12, color: '#BA5BEA' },
        text_purple_14: { fontSize: 14, color: '#BA5BEA' },
        text_purple_20: { fontSize: 20, color: '#BA5BEA' },
        text_purple_18: { fontSize: 18, color: '#BA5BEA' },
        text_purple_15_bold: { fontSize: 15, color: '#BA5BEA' , fontWeight: 'bold'},
        text_purple_15: { fontSize: 15, color: '#BA5BEA' },
        text_purple_17: { fontSize: 17, color: '#BA5BEA' },
        text_purple_19: { fontSize: 19, color: '#BA5BEA' },

        text_purple2_19: { fontSize: 15, color: '#630FE1' },

        text_green_18: { fontSize: 18, color: '#309D39' },
        text_green_14: { fontSize: 14, color: '#309D39' },
        text_green_16: { fontSize: 16, color: '#309D39' },

        text_blue_18: { fontSize: 18, color: '#4A90E2' },
        text_blue_14: { fontSize: 14, color: '#4A90E2' },
        text_blue_13: { fontSize: 13, color: '#4A90E2' },
        text_blue_12: { fontSize: 12, color: '#4A90E2' },
        text_blue_10: { fontSize: 10, color: '#4A90E2' },

        text_green_12: { fontSize: 12, color: 'green' },
        text_green_13: { fontSize: 13, color: 'green' },
        text_green30_12: { fontSize: 12, color: '#309D39' },
        text_green30_18: { fontSize: 18, color: '#309D39' },

        text_yellow_12: { fontSize: 12, color: '#FECC2A' },
        text_yellow_13: { fontSize: 13, color: '#FECC2A' },
        text_yellow: { fontSize: 14, color: '#FECC2A' },
        text_yellow8d_14: { fontSize: 14, color: '#E4CA8D' },
        text_yellow_15: { fontSize: 15, color: '#FECC2A' },
        text_yellow_18: { fontSize: 18, color: '#FFB500' },
        text_yellow_20: { fontSize: 20, color: '#FF1E34' },

        text_orange_12: {fontSize: 12, color: '#FF5C25'},
        text_orange_14: {fontSize: 14, color: '#FF5C25'},
        text_orange_16: {fontSize: 16, color: '#FF5C25'},
        text_orange_17: {fontSize: 17, color: '#FF5C25'},
        text_orange_20: {fontSize: 20, color: '#FF5C25'},
        text_orange_18: {fontSize: 18, color: '#FF5C25'},
        text_orange_36: {fontSize: 36, color: '#FF5C25'},

        text_primary_10: {fontSize: 10, color: '#F9D63B'},
        text_primary_12: {fontSize: 12, color: '#F9D63B'},
        text_primary_14: {fontSize: 14, color: '#F9D63B'},
        text_primary_16: {fontSize: 16, color: '#F9D63B'},
        text_primary_17: {fontSize: 17, color: '#F9D63B'},
        text_primary_20: {fontSize: 20, color: '#F9D63B'},
        text_primary_18: {fontSize: 18, color: '#F9D63B'},
        text_primary_28: {fontSize: 28, color: '#F9D63B'},
        text_primary_36: {fontSize: 36, color: '#F9D63B'},

        page_title: {
            height: Platform.OS === 'ios' ? NAV_BAR_HEIGHT_IOS : NAV_BAR_HEIGHT_ANDROID,
            alignItems: 'center',
            flexDirection: 'row',
            marginTop: isAndroid() ? StatusBar.currentHeight : 0,
        },

        page_title_2: {
            height: Platform.OS === 'ios' ? NAV_BAR_HEIGHT_IOS : NAV_BAR_HEIGHT_ANDROID,
            alignItems: 'center',
            flexDirection: 'row',
            marginTop: isAndroid() ? StatusBar.currentHeight : getStatusBarHeight(),
            justifyContent: 'space-between',
            paddingHorizontal: 15,
        },
        page_title_4: {
            height: Platform.OS === 'ios' ? NAV_BAR_HEIGHT_IOS : NAV_BAR_HEIGHT_ANDROID,
            alignItems: 'center',
            flexDirection: 'row',
            marginTop: isAndroid() ? StatusBar.currentHeight : getStatusBarHeight(),
            justifyContent: 'space-between',
            paddingRight: 15,
        },
        page_title_3: {
            height: Platform.OS === 'ios' ? NAV_BAR_HEIGHT_IOS : NAV_BAR_HEIGHT_ANDROID,
            alignItems: 'center',
            flexDirection: 'row',
            marginTop: isAndroid() ? StatusBar.currentHeight : 0,
            backgroundColor: '#00AEF0',
            justifyContent: 'center',
            paddingHorizontal: 10
        },

        titleView: {
            height: Platform.OS === 'ios' ? NAV_BAR_HEIGHT_IOS : NAV_BAR_HEIGHT_ANDROID,
            alignItems: 'center',
            justifyContent: 'center',
            marginTop: isAndroid() ? StatusBar.currentHeight : 0,
        },
        titleView2: {
            height: Platform.OS === 'ios' ? NAV_BAR_HEIGHT_IOS : NAV_BAR_HEIGHT_ANDROID,
            alignItems: 'center',
            flexDirection: 'row',
            marginTop: isAndroid() ? StatusBar.currentHeight : 0,
        },
        btn: {
            width: windowWidth - 30,
            height: 50,
            marginVertical: 15,
            alignSelf: 'center',
            alignItems: 'center',
            justifyContent: 'center',
            borderRadius: 20,
            backgroundColor: '#a081f4',
        },
        navBar: {
            flexDirection: 'row',
            alignItems: 'center',
            justifyContent: 'space-between',
            height: isIOS() ? NAV_BAR_HEIGHT_IOS : NAV_BAR_HEIGHT_ANDROID,
            paddingHorizontal: 15,
        },
        badge:{position: 'absolute', right: 0, top: 0}
    });

export const dateStyles = {
    dateInput: {
        borderWidth: 0,
        paddingLeft: 0,
        marginLeft: 0,
        alignItems: 'flex-end',
    },
    btnTextConfirm: {
        color: '#F9D63B',
    },
    placeholderText:{
        color:'#999999'
    }
};

export const html_template=`<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
  <style>
      * {
      }

      h1 {
          color: #333333;
      }

      p {
          font-size: 16px;
          color: #0A0A0A;
      }
      body{
          margin:0px;
          padding:0px;
      }
      .hjx-content {
          background-color: #fff;
          min-height: 5rem;
          font-size: 0.8em;
          word-wrap: break-word;
          -webkit-hyphens: auto;
          -ms-hyphens: auto;
          hyphens: auto;
          color: #333;
          text-align: justify; 
          padding:0px 10px;
      }


      .hjx-content * {
          max-width: 100% !important;
          box-sizing: border-box !important;
          -webkit-box-sizing: border-box !important;
          word-wrap: break-word !important
      }

      .hjx-content p {
          clear: both;
          line-height: 150%;
          margin:0px;
      }

      .hjx-content em {
          font-style: italic
      }

      .hjx-content img {
          height: auto !important;
          display: block;
          max-width: 100%;
          height: auto;
          overflow-x: hidden;
      }
  </style>
</head>
<body>
<div class="hjx-content">
  #content#
</div>
</body>
</html>`

export const customStyle = `* {} h1 {color: #333333;} p { font-size: 16px; color:#0A0A0A; }
.hjx-content {
           background-color: #fff;
           min-height: 5rem;
           font-size: 0.8em;
           word-wrap: break-word;
           -webkit-hyphens: auto;
           -ms-hyphens: auto;
           hyphens: auto;
           color: #333;
           text-align: justify;
           padding: 15px 10px;
       }


           .hjx-content * {
               max-width: 100% !important;
               box-sizing: border-box !important;
               -webkit-box-sizing: border-box !important;
               word-wrap: break-word !important
           }

           .hjx-content p {
               clear: both;
               line-height:150%;
               
           }

           .hjx-content em {
               font-style: italic
           }

           .hjx-content img {
               height: auto !important;
               display: block;
               max-width: 100%;
               height: auto;
               overflow-x: hidden;
           }
`;

export const fun = `
         setTimeout(() => {
                             var objs =document.getElementById("downfile");
                             if(objs){
                                 objs.onclick=function(e){
                                        e.preventDefault();
                                        if(window.ReactNativeWebView.postMessage) {
                                            window.ReactNativeWebView.postMessage(JSON.stringify({
                                                    type: 'a',
                                                    url: this.href
                                              }));
                                        }
                                    }
                                }
                               
                               var lives =document.getElementById("openLive");
                                 if(lives){
                                     lives.onclick=function(e){
                                            e.preventDefault();
                                            if(window.ReactNativeWebView.postMessage) {
                                                window.ReactNativeWebView.postMessage(JSON.stringify({
                                                        type: 'live',
                                                        url: this.href
                                                  }));
                                            }
                                        }
                                    }
                                
                                var aNodes = document.getElementsByTagName("img");
                                
                                if(aNodes){
                                    var images = [];
                                    for(var j=0;j<aNodes.length;j++){
                                        var object = aNodes[j];
                                        images.push({url:object.src});
                                    }
                                    for(var i=0;i<aNodes.length;i++){
                                        aNodes[i].onclick=function(){
                                            if(window.ReactNativeWebView.postMessage) {
                                            
                                                window.ReactNativeWebView.postMessage(JSON.stringify({
                                                        type: 'img',
                                                        url: this.src,
                                                        images: images
                                                  }));
                                            }
                                        }
                                    }
                                }
                                
                               var h= document.body.scrollHeight
                               if(h!=null)
                               {
                                  window.ReactNativeWebView.postMessage(JSON.stringify({
                                                        type: 'setHeight',
                                                        height: h
                                                  }));
                               }
                                
                             },500);
        
        `;

export const customStyles = {
  dateInput: {
    borderWidth: 0,
    paddingLeft: 0,
    marginLeft: 0,
    alignItems: 'flex-end',
  },
  btnTextConfirm: {
    color: '#40627E',
  },
  datePicker: {
    justifyContent:'center'
  }
};

export const customTimeStyles = {
  dateInput: {
    borderWidth: 0,
    paddingLeft: 0,
    marginLeft: 0,
    alignItems: 'center',
  },
  btnTextConfirm: {
    color: '#40627E',
  },
  datePicker: {
    justifyContent:'center'
  }
};
